/*     */ package com.zimbra.cs.service.admin;
/*     */ 
/*     */ import com.zimbra.common.account.Key.DistributionListBy;
/*     */ import com.zimbra.common.service.ServiceException;
/*     */ import com.zimbra.common.soap.Element;
/*     */ import com.zimbra.common.util.Log;
/*     */ import com.zimbra.common.util.ZimbraLog;
/*     */ import com.zimbra.cs.account.AccountServiceException;
/*     */ import com.zimbra.cs.account.Group;
/*     */ import com.zimbra.cs.account.Provisioning;
/*     */ import com.zimbra.cs.account.accesscontrol.AdminRight;
/*     */ import com.zimbra.cs.account.accesscontrol.Rights.Admin;
/*     */ import com.zimbra.soap.JaxbUtil;
/*     */ import com.zimbra.soap.ZimbraSoapContext;
/*     */ import com.zimbra.soap.admin.message.RemoveDistributionListAliasRequest;
/*     */ import com.zimbra.soap.admin.message.RemoveDistributionListAliasResponse;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class RemoveDistributionListAlias
/*     */   extends DistributionListDocumentHandler
/*     */ {
/*     */   public boolean domainAuthSufficient(Map context)
/*     */   {
/*  45 */     return true;
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */   public boolean defendsAgainstDelegateAdminAccountHarvesting()
/*     */   {
/*  53 */     return true;
/*     */   }
/*     */   
/*     */   protected Group getGroup(Element request) throws ServiceException
/*     */   {
/*  58 */     String id = request.getAttribute("id", null);
/*  59 */     if (id != null) {
/*  60 */       return Provisioning.getInstance().getGroup(Key.DistributionListBy.id, id);
/*     */     }
/*  62 */     return null;
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */   public Element handle(Element request, Map<String, Object> context)
/*     */     throws ServiceException
/*     */   {
/*  70 */     ZimbraSoapContext zsc = getZimbraSoapContext(context);
/*  71 */     Provisioning prov = Provisioning.getInstance();
/*  72 */     RemoveDistributionListAliasRequest req = (RemoveDistributionListAliasRequest)JaxbUtil.elementToJaxb(request);
/*     */     
/*  74 */     String id = req.getId();
/*  75 */     String alias = req.getAlias();
/*  76 */     Group group = getGroupFromContext(context);
/*     */     
/*  78 */     String dlName = "";
/*     */     try {
/*  80 */       defendAgainstGroupHarvesting(group, Key.DistributionListBy.id, id, zsc, Rights.Admin.R_removeGroupAlias, Rights.Admin.R_removeDistributionListAlias);
/*     */     }
/*     */     catch (AccountServiceException ase) {}
/*     */     
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*  88 */     if (group != null) {
/*  89 */       dlName = group.getName();
/*     */     }
/*     */     
/*     */ 
/*  93 */     checkDomainRightByEmail(zsc, alias, Rights.Admin.R_deleteAlias);
/*     */     
/*     */ 
/*     */ 
/*  97 */     prov.removeGroupAlias(group, alias);
/*     */     
/*  99 */     ZimbraLog.security.info(ZimbraLog.encodeAttrs(new String[] { "cmd", "RemoveDistributionListAlias", "name", dlName, "alias", alias }));
/*     */     
/*     */ 
/* 102 */     if (group == null) {
/* 103 */       throw AccountServiceException.NO_SUCH_DISTRIBUTION_LIST(id);
/*     */     }
/*     */     
/* 106 */     return zsc.jaxbToElement(new RemoveDistributionListAliasResponse());
/*     */   }
/*     */   
/*     */   public void docRights(List<AdminRight> relatedRights, List<String> notes)
/*     */   {
/* 111 */     relatedRights.add(Rights.Admin.R_removeDistributionListAlias);
/* 112 */     relatedRights.add(Rights.Admin.R_removeGroupAlias);
/* 113 */     relatedRights.add(Rights.Admin.R_deleteAlias);
/*     */   }
/*     */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/service/admin/RemoveDistributionListAlias.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */